package com.pine.web.pineframework.controller;

import com.pine.common.beans.ResultVo;
import com.pine.common.beans.pineframework.request.SysLogQueryRequest;
import com.pine.common.beans.pineframework.response.SysLogQueryResponse;
import com.pine.common.beans.request.PageRequest;
import com.pine.common.beans.response.PageResponse;
import com.pine.common.systemlog.annotation.SysLog;
import com.pine.service.pineframework.SysLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 系统日志表 前端控制器
 * </p>
 *
 * @author pine manage
 * @since 2024-08-12
 */
@Tag(name = "系统日志表前端控制器")
@RestController
@RequestMapping("/sys/log")
public class SysLogController {

    @Resource
    private SysLogService sysLogService;

    /**
     * 分页查询
     *
     * @param request 请求
     * @return 分页响应
     */
    @Operation(summary = "分页查询")
    @PostMapping("/pages")
    @SysLog("分页查询")
    public ResultVo<PageResponse<SysLogQueryResponse>> listPages(@RequestBody @Valid PageRequest<SysLogQueryRequest> request) {
        request.defaultPage();
        return ResultVo.success(sysLogService.listPages(request));
    }
}
